home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / win / pascal / statdmo.exe / STATDEMO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-12-06  |  1.9 KB  |  94 lines

  1. program statdemo;
  2. {$R statdemo.res}
  3.  
  4. uses
  5.     status, WinProcs, WinTypes, WObjects, Strings;
  6.  
  7. const
  8.     CM_EDIT_UNDO   =        201;
  9.     CM_EDIT_REDO   =        202;
  10.     CM_EDIT_CUT       =        203;
  11.     CM_EDIT_COPY   =        204;
  12.     CM_EDIT_PASTE  =        205;
  13.     CM_EDIT_DELETE =        206;
  14.     ID_MENU           =        100;
  15.     CM_FILE_OPEN   =        101;
  16.     CM_FILE_SAVE   =        102;
  17.     CM_FILE_SAVEAS =        103;
  18.     CM_FILE_CLOSE  =        104;
  19.     CM_FILE_EXIT   =        105;
  20.  
  21. type
  22.  
  23.  
  24. { Main window object }
  25.  
  26.     PMenuWindow = ^TMenuWindow;
  27.     TMenuWindow = object(TWindow)
  28.     pTStatusBar :PStatusBar;
  29.         procedure WMSize(var Msg: TMessage);
  30.             virtual wm_First + wm_Size;
  31.           procedure WMMenuSelect(var Msg : TMessage);
  32.             virtual wm_First + WM_Menuselect;
  33.         procedure CMFileExit(var Msg : TMessage);
  34.           virtual cm_First + CM_File_exit;
  35.       constructor Init;
  36.   end;
  37.  
  38. { Application object }
  39.  
  40.   TMenuApp = object(TApplication)
  41.     procedure InitMainWindow; virtual;
  42.   end;
  43.  
  44.  
  45. { Constructor for main window object. }
  46.  
  47. constructor TMenuWindow.Init;
  48. begin
  49.   TWindow.Init(nil, 'Status Bar Demo');
  50.   attr.menu :=  LoadMenu(HInstance, pchar(id_menu));
  51.   attr.x := GetSystemMetrics(SM_CXSCREEN) DIV 8;
  52.   attr.Y := GETSystemMetrics(SM_CYSCREEN) DIV  8;
  53.   attr.H := attr.y * 6;
  54.   attr.W := attr.x * 6;
  55.   ptStatusBar := new(Pstatusbar, init(@self));
  56.   if ptstatusBar = NIl then
  57.       Status := EM_INVALIDCHILD;
  58. end;
  59.  
  60. procedure TMenuWindow.CMFileExit(var Msg : TMessage);
  61. begin
  62.     CloseWindow;
  63. end;
  64.  
  65. procedure TMenuWindow.WMMenuSelect(var Msg : TMessage);
  66. begin
  67.     SendMessage(pTStatusBar^.Hwindow, WM_MENUSELECT, msg.WParam, msg.LParam);
  68. end;
  69.  
  70. procedure TmenuWindow.WMSize(var Msg: TMessage);
  71. begin
  72.     TWindow.WMSize(msg);
  73.     pTStatusBar^.AdjustSize(msg.LParamLo,msg.LParamHi);
  74. end;
  75.  
  76.  
  77.  
  78. { Create the application's main window. }
  79.  
  80. procedure TMenuApp.InitMainWindow;
  81. begin
  82.   MainWindow := New(PMenuWindow, Init);
  83. end;
  84.  
  85. var
  86.   MenuApp: TMenuApp;
  87.  
  88. begin
  89.   MenuApp.Init('StatusApp');
  90.   MenuApp.Run;
  91.   MenuApp.Done;
  92. end.
  93.  
  94.